
$(    function(){
    // 获取保存到本地的id、type、url
    var uid=localStorage.id;
    var type=localStorage.type;
    var url=localStorage.url;
    //初始化页面

        $.ajax({
            type: "get",
            url: url+"/boss/base/userinfo",
            data: {id:uid,type:type},// 要提交的表单,
            dataType:'json',
            success: function (msg) {
                if(msg.status=='ok!'){
                    $('#usrname').html(msg.msg.name);
                }
                console.log(msg.msg);
            },
            error: function (error) {
                console.log('登录出错！');
            }
        });
        $('#frame').load('hostsM.html');
    }
);
function skip(url) {
    $("#frame").load(url);

}
function toChangePassword(){

    $("#id").val(localStorage.id);
    $("#type").val(1);
    var obj=$("#exampleModalLabel1").serialize();
    $.ajax({
        type: "get",
        url:  localStorage.url+"/boss/base/changepwd",
        dataType:"json",
        data: obj,// 要提交的表单
        success: function (msg) {
            console.log(msg);

            if(msg.status=="ok!"){
                console.log("好的1");
                alert("修改成功！请重新登录");
                window.location.href="index.html";
            }
            else{
                alert("修改失败，原密码输入错误");

            }



        },
        error: function (error) {
            console.log(error);
        }
    });

}